<template>
  <div>
    <el-breadcrumb separator-class="el-icon-arrow-right">
      <el-breadcrumb-item :to="{ path: '/home' }">首页</el-breadcrumb-item>
      <el-breadcrumb-item>权限管理</el-breadcrumb-item>
      <el-breadcrumb-item>权限列表</el-breadcrumb-item>
    </el-breadcrumb>
    <el-card class="box-card">
      <el-table :data="rightsList" border style="width: 80%">
        <el-table-column type="index" label="#" width="60">
        </el-table-column>
        <el-table-column prop="authName" label="权限名称" width="300">
        </el-table-column>
        <el-table-column prop="path" label="路径" width="300">
        </el-table-column>
        <el-table-column  label="权限等级">
            <template v-slot="scope">
              <el-tag size="mini" v-if="scope.row.level == 0">一级</el-tag>
              <el-tag size="mini" v-else-if="scope.row.level ==1" type="success">二级</el-tag>
              <el-tag size="mini" v-else type="warning">三级</el-tag>
            </template>
         </el-table-column>
      </el-table>
    </el-card>
  </div>
</template>

<script>
export default {
  name: "",
  // 组件注册
  components: {},
  // 父组件传参
  props: {},
  // 变量声明
  data() {
    return {
        rightsList:[]
    };
  },
  // Vue实例创建完成以后执行 数据可用
 async created() {
     let res = await this.$axios.get("rights/list");
    
     let { data,meta } = res.data 
    //  console.log(data,meta)
     if(meta.status == 200){
         this.rightsList = data
     }
 },
  // Vue模板挂载完毕以后执行  DOM节点加载完毕了（可以获取节点了）
  mounted() {},
  // keepalive 缓存进入执行
  activited() {},
  // vue组件更新完毕以后执行
  update() {},
  // 定义事件
  methods: {},
  // 过滤器
  filter: {},
  // 计算属性
  computed: {},
  // 监听属性
  watch: {},
};
</script>

<style scoped>

.box-card{
    margin-top:20px;
}
</style>
